﻿<!--#include file="../Include/Config.asp"-->
<%
Templet_id=cint(request.QueryString("Templet_id"))
call CheckNu(Templet_id,"参数错误！")
if i=1 then
  response.End()
end if
I1 "split_||||"
application.Lock()
sqlstr="select * from templet where Templet_id=" & Templet_id
rs.open sqlstr,conn,1,3
if not rs.eof then
  if rs("Templet_default")=1 then
    application.UnLock()
	rs.close
	response.Write("默认模板无法删除！")
	call pagend()
	response.End()
  end if
  rs.delete
else
  rs.close
  response.Write("未找到该模板！")
  response.End()
end if
rs.close
response.Write("删除成功！")
application.UnLock()
I1 "split_||||"
%>
<table width="100%" align="center" cellpadding="0" cellspacing="0" id="SurveyAdmin" class="table">
<%
dim  sql,order_by,way,page_size,rscount,item_count,page_num,page_now,i
order_by=request.QueryString("order_by")
way=request.QueryString("way")
order_by="Templet_id"
way="desc"
page_size=10
set rscount=conn.execute("select count(*) as item_count from templet")
	item_count=rscount("item_count")
	rscount.close
    page_num=item_count\page_size 
sql="select * from templet order by "&order_by&" "&way&""
rs.open sql,conn,1,3
if not rs.eof then
	rs.pagesize=page_size
	page_now=1
	if trim(request.QueryString("page"))<>"" then
	page_now=cint(trim(request.QueryString("page")))
	end if
	if page_now>rs.pagecount or page_now<0 then
	page_now=1
	end if
	rs.absolutepage=page_now
%>
<tr>
  <th>模板ID</th>
<th>模板名称</th>
<th>模板类型</th>
<th>是否默认</th>
<th>操作</th>
</tr>
<%
  i=1
  while not rs.eof and i<page_size+1
%>
<tr>
  <td><%=rs("Templet_id")%></td>
<td><%=rs("Templet_name")%></td>
<td><%=Get_Template_Column_Name(rs("Templet_column"))%></td>
<td><%=SwitchBoolean(rs("Templet_default"))%></td>
<td>
<a href="Uploadimg/2007930202350.jpg" title="查看预览" class="thickbox">预览</a>
|
&nbsp;<a href="TemplateEdit.asp?Templet_id=<%=rs("Templet_id")%>&keepThis=1&TB_iframe=1&height=400&width=700" title="编辑该模板" class="thickbox">编辑</a>|&nbsp;&nbsp;<a href="#" onClick="{if(confirm('此操作将把该模板删除！\n\n确定要执行此项操作吗？')){TemplateDel(<%=rs("Templet_id")%>);}return 0;}">删除</a>
</td>
</tr>
<%
   rs.movenext
   i=i+1
   wend
%>
<tr>
<td colspan="5" align="right">
<div id="bottom_pagebox" style="padding-right:25px;">
当前第<%=page_now%>页
  <%if page_now=1 then%>首页
  <%else%><a href="TemplateAdmin.asp?page=1">首页</a>
  <%end if%>
  <%if page_now>1 and rs.pagecount>1 then%>
  <a href="TemplateAdmin.asp?page=<%=page_now-1%>">上一页</a>
  <%else%>上一页
  <%end if%>				
  <%if page_now<rs.pagecount then%> 
  <a href="TemplateAdmin.asp?page=<%=page_now+1%>">下一页</a>
  <%else%>下一页
  <%end if%>				
  <%if page_now<>rs.pagecount then%> 
  <a href="TemplateAdmin.asp?page=<%=rs.pagecount%>">尾页</a>
  <%else%>尾页
  <%end if%>
  共<%=rs.pagecount%>页/<%=item_count%>篇</div></td>
</tr>
<%else%>
<tr>
<td colspan="5">&nbsp;</td>
</tr>
<%
end if
rs.close
%>
</table>
